import uni from '@dcloudio/vite-plugin-uni'
import uniTailwindcss from '@uni-helper/vite-plugin-uni-tailwind'
import autoprefixer from 'autoprefixer'
import postcssRemToResponsivePixel from 'postcss-rem-to-responsive-pixel'
import tailwindcss from 'tailwindcss'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni(), uniTailwindcss()],
  css: {
    postcss: {
      plugins: [
        autoprefixer,
        tailwindcss,
        postcssRemToResponsivePixel({
          rootValue: 40, // 意味着 1rem = 40rpx, ml-1转换成 margin-left: 10rpx;
          propList: ['*'], // 默认所有属性都转化
          transformUnit: 'rpx' // 转化的单位,可以变成 px / rpx
        })
      ]
    },
    preprocessorOptions: {
      scss: {}
    }
  }
})
